package KK
{
	import KK.Tip.GlobalTip;
	
	import flash.display.DisplayObjectContainer;
	import flash.events.MouseEvent;
	import flash.utils.Dictionary;

	public class Global
	{

		static public const tip:GlobalTip=GlobalTip.Instance;
		static public var Word:DisplayObjectContainer;
		
		/**
		 * 添加按钮tip 
		 * @param button
		 * @param tipStr
		 * 
		 */
		static private var tipList:Dictionary=new Dictionary;
		static public function addClipTip(button:DisplayObjectContainer,tipStr:String):void{
//			tip.stage==null&&Word.addChild(tip);
			tipList[button]=tipStr;
			
			button.addEventListener(MouseEvent.MOUSE_OVER,onHandler);
			button.addEventListener(MouseEvent.MOUSE_OUT,onHandler);
		}
		
		
		/**
		 * 鼠标事件处理  
		 * @param event
		 * 
		 */
		static private function onHandler(event:MouseEvent):void{
			switch(event.type){
				case MouseEvent.MOUSE_OVER:
					
					tip.ShowMsg(tipList[event.currentTarget]);
					tip.x=event.target.stage.mouseX+1;
					tip.y=event.target.stage.mouseY+1;
					tip.visible=true;
					Word.addChild(tip);
					break;
				case MouseEvent.MOUSE_OUT:
					tip.ShowMsg(tipList[event.currentTarget]);
					tip.visible=false;
					Word.addChild(tip);
					break;
			}
		}
	}
}